package com.renjun.smweb.service.PermissionService;


import com.alibaba.fastjson.JSONObject;
import com.renjun.smweb.dao.pojo.LoginInfo;
import com.renjun.smweb.exceptions.BaseException;
import com.renjun.smweb.exceptions.DataNotFoundException;

import java.sql.SQLException;
import java.util.List;
import java.util.Map;

/**
 * Created by huamin on 2017/2/21.
 * 权限管理接口
 */
public interface PermissionService {
    /**
     * @param
     * @return {roleid:str,dataarea:{xd:[],xfnmg:[],xxxz:[]},menus:[],funcs:[]}
     */
    JSONObject getRoleConfigs(Map<String, Object> params) throws SQLException, BaseException;

    /**
     * @param params {roleid:str,dataarea:{xd:[],xfnmg:[],xxxz:[]},menus:[],funcs:[]}
     * @return
     */
    JSONObject configRole(Map<String, Object> params) throws SQLException;


    /**
     * 新增或替换一个角色
     * @param role 角色信息集合
     * @throws SQLException
     */
    void addOrReplaceRole(Map<String, Object> role,LoginInfo loginInfo)throws SQLException;


    /**
     * @return 查询所有角色菜单
     * @throws SQLException
     */
    List<Map<String,Object>> queryAllRoleMenus()throws SQLException;


    /**
     * @return 查询所有角色功能
     * @throws SQLException
     */
    List<Map<String,Object>> queryAllRoleFuncs()throws SQLException;

    /**
     * @return 查询所有角色数据范围
     * @throws SQLException
     */
    List<Map<String,Object>> queryAllRoleDataAreas()throws SQLException;
    /**
     * @return 查询所有菜单
     * @throws SQLException
     */
    JSONObject queryAllMenus()throws SQLException;

    /**
     * @return 查询所有功能
     * @throws SQLException
     */
    JSONObject queryAllFuncs()throws SQLException;

    JSONObject queryAllButtons()throws SQLException;

    //* @param {roleid}
    //* @return{id,sort,desc,roleid,name,lv,parentid}
    JSONObject getMenuListByRoleId(Map<String,Object> params)throws SQLException;

}
